package actions;

import constants.*;

import interfaces.impl.Action;
import objects.SpetialFeature;
import universe.Universe;

public class ActionIncreaseMoney extends Action{
	
	public ActionIncreaseMoney(int priority){
		super(priority);
		this.id=Constants.ACTION_INCREASE_MONEY;
	}
	public ActionIncreaseMoney(){
		super();
		this.id=Constants.ACTION_INCREASE_MONEY;
		
	}
	
	
	
	@Override
	public boolean processAction(Universe world) {
		
		SpetialFeature moneyToIncrease= new SpetialFeature();
		SpetialFeature money = new SpetialFeature();
		
		int cont=0;
		
		for(SpetialFeature fe : target.getListFeatures()){
			if(fe.getId()==Constants.SPETIAL_FEATURE_MONEY){
				money = fe;
				cont++;
			}
			if(fe.getId()==Constants.SPETIAL_FEATURE_MONEY_TO_INCREASE){
				moneyToIncrease = fe;
				cont++;
			}
		}
		
		if(cont!=2){
			return false;
		}
		
		money.setValue(money.getValue()+moneyToIncrease.getValue());
		return true;
		
	}
	@Override
	public String getName() {
		// TODO Auto-generated method stub
		return "Money Increase" ;
	}
	

}
